package com.bblocks.exception;


import com.bblocks.enums.SysEnum;

/**
 * @Author: Mei
 * 异常类
 * @Date: created in 2018/12/26 14:11.
 */

public class ServiceException extends RuntimeException  {

	private static final long serialVersionUID = 1L;

	/**
	 * 具体异常码
	 */
	private Integer code;//错误码


	public ServiceException() {}


	public ServiceException(SysEnum sysEnum){
		super(sysEnum.getMessage());
		this.code = sysEnum.getCode();
	}
	/**
	 * 通用业务错误，错误码：0
	 * @param message
	 */
	public ServiceException(String message) {
		super(message);
		this.code = SysEnum.ERROR.getCode();
	}

	public ServiceException(Integer code, String message){
		super(message);
		this.code = code;
	}


	public Integer getCode() {
		return code;
	}

	public void setCode(Integer code) {
		this.code = code;
	}


}